package net.zjitc.call;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author: Administrator
 * @Date: 2020/5/21 18:22
 * 将班级同学姓名的数组保存在request域，转发到jsp页面，
 *  在jsp页面上取出request域中的数据，展示
 */
@WebServlet("/randomCall")
public class RandomCall1 extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String[] yd1901 = {"朱新舜", "万泽豪", "卢渊", "柳嘉豪", "朱善沛", "吴焘均", "俞文瀚", "郭勇杰",
                "阚传龙", "林志强", "杨校", "廖明浙", "温正雍", "年亚轩", "符文杰", "廖毕龙",
                "黄慧刚", "李求民", "徐晨韬", "毛建成", "卢长安", "洪耀荣", "周自强", "吴俣震", "薛成好",
                "潘忠强", "饶志刚", "张军", "于飞扬", "胡海洋", "杨成明", "张乐", "金煜凯", "叶凯", "余斌",
                "高世宇", "顾镕泽", "孔佳豪"};
        req.setAttribute("yd_list",yd1901);
        req.getSession().setAttribute("yd_list",yd1901);
        req.getRequestDispatcher("/call.jsp").forward(req,resp);

        Object name = req.getSession().getAttribute("name");
        


    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req,resp);
    }
}
